﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using System.Data.Linq;

using Inbox.Domain;

namespace Inbox.Bussiness
{

    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "LoginService" in code, svc and config file together.
    public class LoginService : ILoginService
    {
        public void DoWork()
        {
        }

        public bool GetLogin(string userName, string passWord)
        {
            using (InboxContext context = new InboxContext())
            {
                var query = from q in context.GetTable<InboxUser>()
                                 where q.UserName == userName && q.Password == passWord
                                 select q;

                return query.FirstOrDefault() != null;
            }
        }
    }
}
